<template>
  <div id="napin">
    <router-view  v-wechat-title="$route.meta.title" v-if="isRouterAlive"/>
  </div>
</template>

<script>
  import 'babel-polyfill'
  export default {
    name: 'App',
    provide(){
      return{
        reload:this.reload
      }
    },
    data(){
      return{
        isRouterAlive:true,
      }
    },
    methods:{
      reload(){
        this.isRouterAlive = false;
        this.$nextTick(function () {
          this.isRouterAlive = true;
        })
      },
      isWeiXin() {
        var ua = window.navigator.userAgent.toLowerCase(); 
        if (ua.match(/MicroMessenger/i) == 'micromessenger') { 
            // this.radio=0;
            return true; 
            
        } else { 
            return false; 
        } 
      }
    },
    mounted () {
        if(this.$route.query.openid){
          localStorage.setItem('openid',this.$route.query.openid)
        }
        if(location.href.indexOf(/\?from=timeline||\?from=groupmessag||\?from=singlemessage/g)){
          var url=location.href.replace('?from=singlemessage','');
          url=url.replace('?from=groupmessage','');
          url=url.replace('?from=timeline','');
          url=url.replace('&isappinstalled=0','');
          url=url.replace('&isappinstalled=1','');
          location.href=url;
        }
        var go_url = 'https://super.napin.com/api/wxlogin/getwxcode?url='+escape(location.href);
      if(this.isWeiXin()){
        if(localStorage.getItem('openid')){

        }else{
          location.href=go_url;
        }
        
      }else{
        
      }
    }
}
</script>

<style lang="scss">
  *{
    margin: 0px;padding:0px;font-family: "PingFang-SC-Regular";}
  .clear{clear:both}
  /*.van-tabs__wrap{
    width: 28vw;
    left:30%;
  }*/
  .checkedAll{
    line-height: 40px;
    .van-checkbox__icon{
        margin-top:10px;
    }
    .van-checkbox__label{
        line-height: 40px;
    }
    
}
.van-checkbox__icon{
    float: left;
    margin-top: 44px;
}
.van-checkbox__label{
    display: block;
    margin-left: 30px;
}
  img{
     width: 100%;
  }
  .van-button--warning{
    border: none!important;
  }
  .van-swipe__indicator{
    background:#666666!important;
  }
  .van-tabs--line .van-tabs__wrap{
    // height: 26vw;
  } .van-tab--active div,.van-tab--active span{
      // color: #fff !important;
    }

  .van-tabs__content{
    // margin-top: 10px !important;
  }
  
  .van-switch--on {
    background-color: #f44!important;
}
.van-picker__cancel, .van-picker__confirm {
    color: #f44!important;
    padding: 0 15px;
    font-size: 14px;
}
  // .van-checkbox__icon .van-icon{
  //   width: 16px!important;
  //   height: 16px!important;
  // }
  // .van-checkbox__icon, .van-checkbox__label{
  //   line-height: 16px!important;
  // }
  .van-checkbox__icon, .van-checkbox__label{
    height: auto!important;
  }

</style>
